package com.mxdx.edu.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mxdx.edu.dao.SalesManInfoDao;
import com.mxdx.edu.service.ISalesManInfoService;

@Service
public class SalesManInfoServiceImpl implements ISalesManInfoService {

	@Resource
	private SalesManInfoDao salesManInfoDao;

	@Override
	public boolean checkSalesManByMap(Map<String, Object> param) {
		List<Map<String, Object>> list = salesManInfoDao.findListByMap(param);
		if(list != null && list.size() > 0) {
			return true;
		}
		return false;
	}

	@Override
	public Map<String, Object> findMapByMap(Map<String, Object> param) {
		List<Map<String, Object>> list = salesManInfoDao.findListByMap(param);
		if(list != null && list.size() > 0) {
			Map<String, Object> retMap = list.get(0);
			return retMap;
		}
		return null;
	}

	@Override
	public Map<String, Object> findAgentById(Map<String, Object> param) {
		List<Map<String, Object>> list = salesManInfoDao.findAgentById(param);
		if(list != null && list.size() > 0) {
			Map<String, Object> retMap = list.get(0);
			return retMap;
		}
		return null;
	}


	@Override
	public Map<String, Object> findRecommendationCompanySalesMan(Map<String, Object> param) {
		List<Map<String, Object>> list = salesManInfoDao.findRecommendationCompanySalesMan(param);
		if(list != null && list.size() > 0) {
			Map<String, Object> retMap = list.get(0);
			return retMap;
		}
		return null;
	}

	@Override
	public List<Map<String, Object>> findRecommendationCompanyList(Map<String, Object> param) {
		return salesManInfoDao.findRecommendationCompanyList(param);
	}

	@Override
	public Map<String, Object> findRecommendationPeoplesSalesMan(Map<String, Object> param) {
		List<Map<String, Object>> list = salesManInfoDao.findRecommendationPeoplesSalesMan(param);
		if(list != null && list.size() > 0) {
			Map<String, Object> retMap = list.get(0);
			return retMap;
		}
		return null;
	}
}
